home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "PictPlus Sample Project (use this as a template)"
- ClientHeight = 5115
- ClientLeft = 3345
- ClientTop = 1500
- ClientWidth = 6690
- Height = 5520
- Left = 3285
- LinkTopic = "Form1"
- ScaleHeight = 5115
- ScaleWidth = 6690
- Top = 1155
- Width = 6810
- Begin VB.ComboBox Combo3
- Height = 315
- Left = 4710
- Style = 2 'Dropdown List
- TabIndex = 11
- Top = 2670
- Width = 1215
- End
- Begin VB.CommandButton Command3
- Caption = "&Open Image"
- Height = 300
- Left = 4695
- TabIndex = 9
- Top = 810
- Width = 1230
- End
- Begin VB.CommandButton Command2
- Caption = "&Invert"
- Height = 315
- Left = 4725
- TabIndex = 8
- Top = 4125
- Width = 1215
- End
- Begin VB.ComboBox Combo2
- Height = 315
- Left = 4695
- Style = 2 'Dropdown List
- TabIndex = 6
- Top = 3495
- Width = 1215
- End
- Begin VB.ComboBox Combo1
- Height = 315
- Left = 4695
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 1860
- Width = 1215
- End
- Begin VB.HScrollBar HScroll1
- Height = 240
- Left = 825
- TabIndex = 2
- Top = 4500
- Width = 2820
- End
- Begin VB.VScrollBar VScroll1
- Height = 2865
- Left = 4320
- TabIndex = 1
- Top = 1260
- Width = 225
- End
- Begin VB.PictureBox Picture2
- BackColor = &H0000FFFF&
- Height = 3600
- Left = 345
- ScaleHeight = 3540
- ScaleWidth = 3855
- TabIndex = 0
- Top = 810
- Width = 3915
- Begin VB.PictureBox Picture1
- BackColor = &H00FFFFFF&
- Height = 1065
- Left = 120
- ScaleHeight = 1005
- ScaleWidth = 990
- TabIndex = 3
- Top = 90
- Width = 1050
- End
- End
- Begin VB.Label Label1
- Height = 240
- Left = 5535
- TabIndex = 14
- Top = 4695
- Width = 630
- End
- Begin VB.Label Label6
- Caption = "Status:"
- Height = 225
- Left = 4755
- TabIndex = 13
- Top = 4695
- Width = 660
- End
- Begin VB.Label Label5
- Height = 690
- Left = 45
- TabIndex = 12
- Top = 45
- Width = 6615
- End
- Begin VB.Label Label4
- Caption = "Scale:"
- Height = 225
- Left = 4695
- TabIndex = 10
- Top = 2430
- Width = 1095
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 6015
- Top = 3585
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327681
- End
- Begin VB.Label Label3
- Caption = "Rotation:"
- Height = 225
- Left = 4695
- TabIndex = 7
- Top = 3255
- Width = 1185
- End
- Begin VB.Label Label2
- Caption = "Page:"
- Height = 225
- Left = 4695
- TabIndex = 5
- Top = 1635
- Width = 1185
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim obj As Object
- Dim scaledown, previnvert, stopvar As Integer
- Dim vFile, prevFile As String
- Dim pPictPlus As PictureBox
- Dim ww, hh As Long
- Dim oldscale, vScale, rotatevar, prevrotate, prevpage As Single
- Function showpicture(ByVal param)
- 'call the DisplayPict function
- result = obj.DisplayPict(param)
- dummy = DoEvents()
- 'retrieve the image from the Clipboard.
- 'Clipboard is used because of a Microsoft bug in
- 'the Picturebox which causes a memory leak.
- Picture1.Picture = Clipboard.GetData()
- 'specify the scrollbar metrics
- HScroll1.Max = Picture1.Width - Picture2.Width + 120
- VScroll1.Max = Picture1.Height - Picture2.Height + 120
- 'show scrollbars only if the image does not fit into display area.
- If Picture1.Width > Picture2.Width Then
- HScroll1.Visible = True
- HScroll1.Visible = False
- End If
- If Picture1.Height > Picture2.Height Then
- VScroll1.Visible = True
- VScroll1.Visible = False
- End If
- 'display of return value (probably not needed in your app)
- Label1 = result
- dummy = DoEvents()
- 'create list of page numbers
- If Val(result) > 0 Then
- If Combo1.ListCount <> Val(result) Then
- stopvar = 1
- Combo1.Clear
- For i = 1 To Val(result)
- Combo1.AddItem i
- Next
- Combo1.ListIndex = 0
- End If
- End If
- If Val(result) < 2 Then
- Combo1.Enabled = False
- Combo1.Enabled = True
- End If
- stopvar = 0
- End Function
- Private Sub Combo1_Click()
- If stopvar = 1 Then
- Exit Sub
- End If
- param = "pg=" & Combo1 & ",inv=0,rot=0"
- dummy = showpicture(param)
- End Sub
- Private Sub Combo2_Click()
- If stopvar = 1 Then
- Exit Sub
- End If
- param = "rot=" & Combo2
- dummy = showpicture(param)
- End Sub
- Private Sub Combo3_Click()
- If stopvar = 1 Then
- Exit Sub
- End If
- param = "scale=" & Val(Combo3)
- dummy = showpicture(param)
- End Sub
- Private Sub Command2_Click()
- param = "inv=1"
- dummy = showpicture(param)
- End Sub
- Private Sub Command3_Click()
- CommonDialog1.Action = 1
- param = "file=" & CommonDialog1.filename & ",rot=0,inv=0,error=1"
- dummy = showpicture(param)
- Combo2.ListIndex = 0
- End Sub
- Private Sub Form_Load()
- 'create the PictPlus object
- Set obj = CreateObject("PictPlus.ClsPictPlus")
- 'adjust size and position of display PictureBox
- Picture1.BorderStyle = 0
- Picture1.Width = Picture2.Width
- Picture1.Height = Picture2.Height
- Picture1.Left = 0
- Picture1.Top = 0
- 'adjust size and position of scroll bars
- VScroll1.Height = Picture2.Height
- VScroll1.Top = Picture2.Top
- VScroll1.Left = Picture2.Left + Picture2.Width
- HScroll1.Width = Picture2.Width
- HScroll1.Left = Picture2.Left
- HScroll1.Top = Picture2.Top + Picture2.Height
- 'specify the metric for the scroll bars
- HScroll1.SmallChange = Picture2.Width \ 10
- VScroll1.SmallChange = Picture2.Height \ 10
- HScroll1.LargeChange = Picture2.Width * 0.75
- VScroll1.LargeChange = Picture2.Height * 0.75
- 'set Picture1 properties
- Picture1.AutoRedraw = True
- Picture1.AutoSize = True
- 'remove yellow background color for better cosmetics
- Picture2.BackColor = RGB(255, 255, 255)
- 'set the Combobox values. Sopvar is neede to prevent looping
- stopvar = 1
- Combo2.AddItem "0"
- Combo2.AddItem "90"
- Combo2.AddItem "180"
- Combo2.AddItem "270"
- Combo2.ListIndex = 0
- stopvar = 0
- stopvar = 1
- Combo3.AddItem "auto"
- Combo3.AddItem "25"
- Combo3.AddItem "33"
- Combo3.AddItem "50"
- Combo3.AddItem "75"
- Combo3.AddItem "100"
- Combo3.AddItem "150"
- Combo3.AddItem "200"
- Combo3.ListIndex = 0
- stopvar = 0
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- 'release of object.
- Set obj = Nothing
- End Sub
- Private Sub HScroll1_Change()
- Picture1.Left = 0 - HScroll1
- End Sub
- Private Sub VScroll1_Change()
- Picture1.Top = 0 - VScroll1
- End Sub
-